
// 可以将 Symbol 函数当作转换函数使用
// 使用 Symbol 函数可以将任意值转换为 symbol 类型的值
let first = Symbol( 1001 );
console.log( first , typeof(first) );

let second = Symbol( 1001 );
console.log( second , typeof(second) );

console.log( first == second ); // false
console.log( first === second ); // false

console.log( '- - - - - - - - - - - - - - - - - - -');

// let third = new Symbol(); // TypeError: Symbol is not a constructor

let third = Symbol( 'ABC123' );
console.log( third , typeof(third) );

// 可以借助于 Object函数 将 symbol 类型的值 包裹到一个 Symbol实例中
let fourth = Object( third ); // 手动装箱
console.log( fourth , typeof(fourth) );

let str = fourth.toString() ;
console.log( str , typeof(str) );

let primitive = fourth.valueOf() ; // 手动拆箱
console.log( primitive , typeof(primitive) );

console.log( third === primitive ); // true